package classfile

import "fmt"

type ClassFile struct {
	magic             uint32
	minorVersion      uint16
	majorVersion      uint16
	constantPool      ConstantPool
	accessFlag        uint16
	thisClass         uint16
	superClass        uint16
	interClass        []uint16
	fields            []*MemberInfo
	methods           []*MemerInfo
	attributes        []AttributeInfo
}

/*把[]byte解析成ClassFile*/
func Parse(classData []byte) (cf *ClassFile, err error) {
	defer func() {
		if r := recover(); r != nil {
			var ok bool
			err, ok = r.(error)
			if !ok {
				err = fmt.Errorf("%v", r)
			}
		}
	}()

	cr := &ClassReader{classData}
	cf = &ClassFile{}
	cf.read(cr)
	return
}


func (self *ClassFile) read(reader *ClassReader) {

}

func (self *ClassFile) MajorVersion() uint16 {
	return self.majorVersion
}













